package ch.ethz.inf.shop.model;

import java.sql.ResultSet;
import java.sql.SQLException;

import ch.ethz.inf.shop.Title;

/**
 * Object that represents a category of items (i.e. Food)
 */
public final class Category {

	@Title(text = "Category Name", isVisible = true)
	private final String name;
	@Title(text = "Category ID", isVisible = false)
	private final int categoryId;

	@Override
	public String toString() {
		return name;
	}

	public Category(String name, int categoryId) {
		super();
		this.name = name;
		this.categoryId = categoryId;
	}

	public Category(final ResultSet rs) throws SQLException {
		this.categoryId = rs.getInt("category_id");
		this.name = rs.getString("category_name");
	}

	public final String getName() {
		return name;
	}

	public int getCategoryId() {
		return categoryId;
	}

}
